#pragma once


#if _IS_UI_DESIGNED_ENABLED_


#include <IXUIDrager.h>
#include "../../Skin/Source/XFrameImpl.h"


template <class I>
class CXUIDragerImpl : public CXFrameImpl<I>
{
    typedef CXFrameImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXUIDrager, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXUIDrager,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXUIDragerImpl, superclass, _T("UIDrager"));

public:
    CXUIDragerImpl();
    virtual ~CXUIDragerImpl();

public:
    // IXUIDragerer
    virtual HRESULT STDMETHODCALLTYPE put_Dragee(IN IXFrame* pUIDragee);

public:
    // IXFrame
    virtual BOOL STDMETHODCALLTYPE   OnMouseDown(POINT* pt);
    virtual BOOL STDMETHODCALLTYPE   OnMouseUp(POINT* pt);
    virtual BOOL STDMETHODCALLTYPE   OnMouseMove(IN POINT* pt);

    virtual void STDMETHODCALLTYPE   OnCaptureLost();

public:
    // IXControl
    virtual void    STDMETHODCALLTYPE   GetAutoSize(OUT LPSIZE pAutoSize);
    virtual HRESULT STDMETHODCALLTYPE   GetItemByPt(POINT& pt, IXControl** ppItem);

    virtual void    STDMETHODCALLTYPE   PostDraw(XCANVAS xCanvas, const RECT& rcDraw);

public:
    // IXBaseObj
    virtual void    STDMETHODCALLTYPE   OnFinalRelease();

protected:
    // CXUIDragerImpl
    void        ReleaseData();
    BOOL        NeedImageList();
    void        BeginDrag(const POINT* ppt);
    void        MoveDrag(const POINT* ppt);
    void        EndDrag(BOOL bCancel);

protected:
    IXFrame*    m_pUIDragee;

    HIMAGELIST  m_ImageList;
};


class CXUIDrager : public CXUIDragerImpl<IXUIDrager>
{
};



#endif // _ENABLE_UI_DESIGNER_
